home *** CD-ROM | disk | FTP | other *** search
- " object to control updating of AA window "
- "
- *
- * buttons.self,v 1.1 1993/07/22 00:15:14 richards Exp
- *
- * buttons.self,v
- # Revision 1.1 1993/07/22 00:15:14 richards
- # Moved back to having event handlers per operation.
- # eventHandler/buttons now support substitution.
- # poly.self has primitive substitution handler, except that it has
- # no concept of context.
- #
- *
- *
- **************************
- ***** BUTTONS ****
- **************************
- "
-
- " :=(ADDSLOTS)=: "
- aa _AddSlotsIfAbsent: (| views* = (). |)
- aa views _AddSlotsIfAbsent: (| traits = () |)
- aa views _AddSlotsIfAbsent: (| prototypes* = () |)
-
- " :=(TRAITS DEFINITIONS)=:aa views "
- aa views traits _AddSlotsIfAbsent: ( |
- actionButton = ().
- textButton = ().
- imageButton = ().
- editorButtons = ().
- |)
-
- aa views prototypes _AddSlotsIfAbsent: (|
- actionButton = ().
- textButton = ().
- imageButton = ().
- editorButtons = ().
- |)
-
- aa views traits actionButton _Define: (|
- _ parent** = traits view.
-
- copySelector: s = (|c| c: copy. c).
- copySelector: s Label: l = (|c|
- c: copy.
- c label: l. c
- ).
-
- "override parameters"
- leftMargin = 1.
- topMargin = 1.
-
- "_" copyUnrealised: sv = (|c|
- c: resend.copyUnrealised: sv.
- c selected: false.
- c
- ).
-
- calculateSubViewSize = (42).
- recalculateSubViewSize = ( calculateSubViewSize ).
-
- fixUpSuperViewSlots = (
- superView buttons at: buttonNum Put: self.
- ).
-
- realise: v = (
- selected: false.
- resend.realise: v.
- calculateSubViewSize.
- self
- ).
-
- enterNotify: event = (selected: true. drawModel).
- leaveNotify: event = (selected: false. drawModel).
-
- selectUp: pt = (
- selected ifTrue: [|t|
- selected: false.
- drawModel. flush.
-
- performAction.
-
- selected: true.
- drawModel. flush.
- ].
- ).
-
- performAction = (printLine).
-
- redraw = (ifRealised: [drawModel]).
-
- ^ drawModel = (
- |fg. bg|
-
- selected ifTrue: [fg: manager gcb. bg: manager gc]
- False: [fg: manager gc. bg: manager gcb].
-
- "background"
- window fillRectangle: (0@0)##(width@@height) GC: bg.
-
- drawContents: fg BG: bg.
- self
- ).
-
- |)
-
-
- aa views prototypes actionButton _Define: view
- aa views prototypes actionButton _AddSlots: (|
- _ parent* = aa views traits actionButton.
- _ iName <- 'actionButton'.
- iArea <- (10@350)##(10@@10).
- buttonNum <- 1.
- selected <- false.
- |)
-
- aa views prototypes actionButton eventMaskAdd: xlib events buttonReleaseMask
- aa views prototypes actionButton eventMaskAdd: xlib events buttonPressMask
- aa views prototypes actionButton eventMaskAdd: xlib events enterWindowMask
- aa views prototypes actionButton eventMaskAdd: xlib events leaveWindowMask
-
-
- aa views traits textButton _Define: (|
- _ parent* = aa views traits actionButton.
- ^ copy = (|c|
- c: resend.copy.
- c
- ).
-
- printString = (
- '<textButton>Label: ',label
- ).
-
- calculateSubViewSize = (
- ifRealised: [
- area: (area origin)##(((textWidth: caption) + leftMargin double)@@
- (topMargin double + textHeight: caption))
- ].
- ).
-
- _ drawContents: fg BG: bg = (
- window drawString: caption
- At: leftMargin@(topMargin + textAscent: caption)
- GC: fg.
- ).
-
- ^ label: s = (
- iLabel: s.
- calculateSubViewSize.
- redraw
- ).
- ^ label = (iLabel).
-
- ^ caption = (iLabel).
- |)
-
- aa views prototypes textButton _Define: aa views actionButton
- aa views prototypes textButton _AddSlots: (|
- _ parent* = aa views traits textButton.
- iLabel <- 'myButton'.
- |)
-
- aa views traits imageButton _Define: (|
- _ parent* = aa views traits actionButton.
- ^ copy = (| c. |
- c: resend.copy.
- c
- ).
-
- ^ realise = (| c. |
- resend.realise.
- suckBitmap.
- ).
-
- ^ printString = (
- '<imageButton>Bitmap: ',bitmapName
- ).
-
- ^ drawContents: fg BG: bg = (
- bitmap isNil ifFalse: [
- bitmap drawOn: window GC: fg At: 0@0.
- ].
- self
- ).
-
- ^ suckBitmap = (
- bitmap: manager findBitmap: bitmapName Window: window.
- ).
-
- ^ bitmapName: bm = (
- iBitmapName: bm.
- ifRealised: [ suckBitmap. ].
- ).
-
- ^ bitmapName = ( iBitmapName ).
-
- ^ calculateSubViewSize = (
- (isRealised && (bitmap isNil not)) ifTrue: [
- area: (area origin)##(bitmap size).
- ].
- ).
- |)
-
- aa views prototypes imageButton _Define: aa views actionButton
- aa views prototypes imageButton _AddSlots: (|
- _ parent* = aa views traits imageButton.
- iBitmapName <- 'Divide'.
- bitmap.
- |)
-
- ":=(TRAITS DEFINITIONS)=:aa views editorButtons "
- aa views editorButtons _Define: (|
- quitButton = ().
- substituteButton = ().
- areaSelectionButton = ().
- allButtons <- list copy.
- |)
-
- aa views editorButtons quitButton _Define: aa views textButton.
- aa views editorButtons quitButton _AddSlots: (|
- iLabel <- 'quit'.
- buttonNum <- 1.
- performAction = (
- topView unmap.
- topView manager close.
- ).
- |)
-
- aa views editorButtons substituteButton _Define: aa views textButton.
- aa views editorButtons substituteButton _AddSlots: (|
- iLabel <- ' <- '.
- buttonNum <- 2.
- performAction = (
- topView captionText: 'Please select the thing to substitute.'.
- topView handlerForNextWindow: aa editor substitutionSelectionEventHandler.
- ).
- |)
-
- aa views editorButtons areaSelectionButton _Define: aa views textButton.
- aa views editorButtons areaSelectionButton _AddSlots: (|
- iLabel <- 'area'.
- buttonNum <- 3.
- performAction = (
- topView handlerForNextWindow: aa editor areaSelectionHandler.
- ).
- |)
-
- aa views editorButtons allButtons add: aa views editorButtons quitButton.
- aa views editorButtons allButtons add: aa views editorButtons areaSelectionButton.
- aa views editorButtons allButtons add: aa views editorButtons substituteButton.
-
-